export const routes = [{
        path: '/',
        name: 'Main',
        component: r => require(['../views/Main.vue'], r),
        children: [{
                path: 'home',
                alias: '',
                name: 'Home',
                component: () => import('../views/Home.vue')
            }, {
                path: 'menu',
                name: 'Menu',
                component: () => import('../views/Menu.vue')
            },
            {
                path: 'shopbag',
                name: 'Shopbag',
                component: () => import('../views/Shopbag.vue'),
                // beforeEnter: (to, from, next) => {
                //     let isLogin = sessionStorage.getItem('isLogin');
                //     if (isLogin === 'true') {
                //         
                //         next();
                //     } else {
                //         
                //         next({
                //             path: '/login'
                //         });
                //     }
                // }
            },
            {
                path: 'my',
                name: 'My',
                component: () => import('../views/My.vue'),
                beforeEnter: (to, from, next) => {
                    let isLogin = sessionStorage.getItem('isLogin');
                    if (isLogin === 'true') {
                        
                        next();
                    } else {
                        
                        next({
                            path: '/login'
                        });
                    }
                }
            }
        ]
    },
    {
        path: '/shopMes',
        name: 'ShopMes',
        component: () => import('../views/ShopMes.vue')
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import('../views/Login.vue')
    },
    {
        path: '/userMes',
        name: 'UserMes',
        component: () => import('../views/UserMes.vue')
    },
    {
        path: '/collect',
        name: 'Collect',
        component: () => import('../views/Collect.vue')
    },
    {
        path: '/indent',
        name: 'Indent',
        component: () => import('../views/Indent.vue')
    },
    {
        path: '/address',
        name: 'Address',
        component: () => import('../views/Address.vue')
    },
    {
        path: '/newAddress',
        name: 'NewAddress',
        component: () => import('../views/NewAddress.vue')
    },
    {
        path: '/addressEdit',
        name: 'AddressEdit',
        component: () => import('../views/AddressEdit.vue')
    },
    {
        path: '/orderSet',
        name: 'OrderSet',
        component: () => import('../views/OrderSet.vue')
    },
    {
        path: '/sousuo',
        name: 'Sousuo',
        component: () => import('../views/Sousuo.vue')
    },
    {
        path: '/safe',
        name: 'Safe',
        component: () => import('../views/Safe.vue')
    },
    {
        path: '/forget',
        name: 'Forget',
        component: () => import('../views/Forget.vue')
    },
    {
        path: '/reset',
        name: 'Reset',
        component: () => import('../views/Reset.vue')
    },

]